<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Math extends Site_Controller
{

   /**
   * Check user logged in
   *
   * if(!$this->session->userdata('isLogin')){
   *   redirect('login');
   *   exit();
   * }
   * 
   * @return boolean [description]
   */

  function __construct()
  {
    parent::__construct();
    $this->load->model(array('mod_math'));
  }
  
  public function view()
  {
	if(!$this->session->userdata('isLogin')){
	   redirect('login');
	   exit();
	}
    $this->title  = 'Math';
  }
  public function disciplines(){
  	if(!$this->session->userdata('isLogin')){
	   redirect('login');
	   exit();
	}
  	$this->title  = "វិញ្ញាសាគណិតវិទ្យា";
    $keeping = $this->uri->segment(3,0);
  	$uriSegment = 5;
    $perPage = 1;
    $this->data = $this->mod_math->getAllmath(uri($uriSegment), $perPage, $keeping);
    pagination_config(site_url(module_controller(''.$keeping.'/page')),$this->mod_math->getMathNum($keeping), $perPage, $uriSegment); //per_page, segment
  
  }
  public function anwser(){
  	if(!$this->session->userdata('isLogin')){
	   redirect('login');
	   exit();
	}
    $this->anwser = $this->mod_math->getAnwser();
  	$this->title = 'ចំលើយ/Anwser';
  }

}